package au.com.betaversion.domain;

import java.util.Date;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

@Document
public class Photo implements Comparable<Photo> {
	
	@Id
	private String id;
	
	private String originalFileName;
	
	private String contentType;
	
	private byte[] photo;
	
	private byte[] thumbnail;
	
	private String storageId;
	
	private Date dateUploaded;
	
	private Date dateTaken;
	
	private int views;

	private String comment;
	
	@DBRef
	private RegisteredUser registeredUser;
	
	@DBRef
	private Aircraft aircraft;
	
	@DBRef
	private Airport airport;
	
	/**
	 * @return the contentType
	 */
	public String getContentType() {
		return contentType;
	}
	/**
	 * @param contentType the contentType to set
	 */
	public void setContentType(String contentType) {
		this.contentType = contentType;
	}
	/**
	 * @return the dateUploaded
	 */
	public Date getDateUploaded() {
		return dateUploaded;
	}
	/**
	 * @param dateUploaded the dateUploaded to set
	 */
	public void setDateUploaded(Date dateUploaded) {
		this.dateUploaded = dateUploaded;
	}
	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}
	/**
	 * @return the views
	 */
	public int getViews() {
		return views;
	}
	/**
	 * @param views the views to set
	 */
	public void setViews(int views) {
		this.views = views;
	}
	/**
	 * @return the dateTaken
	 */
	public Date getDateTaken() {
		return dateTaken;
	}
	/**
	 * @param dateTaken the dateTaken to set
	 */
	public void setDateTaken(Date dateTaken) {
		this.dateTaken = dateTaken;
	}
	/**
	 * @return the thumbnail
	 */
	public byte[] getThumbnail() {
		return thumbnail;
	}
	/**
	 * @param thumbnail the thumbnail to set
	 */
	public void setThumbnail(byte[] thumbnail) {
		this.thumbnail = thumbnail;
	}
	/**
	 * @return the registeredUser
	 */
	public RegisteredUser getRegisteredUser() {
		return registeredUser;
	}
	/**
	 * @param registeredUser the registeredUser to set
	 */
	public void setRegisteredUser(RegisteredUser registeredUser) {
		this.registeredUser = registeredUser;
	}
	/**
	 * @return the photo
	 */
	public byte[] getPhoto() {
		return photo;
	}
	/**
	 * @param photo the photo to set
	 */
	public void setPhoto(byte[] photo) {
		this.photo = photo;
	}
	/**
	 * @return the comment
	 */
	public String getComment() {
		return comment;
	}
	/**
	 * @param comment the comment to set
	 */
	public void setComment(String comment) {
		this.comment = comment;
	}
	/**
	 * @return the originalFileName
	 */
	public String getOriginalFileName() {
		return originalFileName;
	}
	/**
	 * @param originalFileName the originalFileName to set
	 */
	public void setOriginalFileName(String originalFileName) {
		this.originalFileName = originalFileName;
	}
	/**
	 * @return the aircraft
	 */
	public Aircraft getAircraft() {
		return aircraft;
	}
	/**
	 * @param aircraft the aircraft to set
	 */
	public void setAircraft(Aircraft aircraft) {
		this.aircraft = aircraft;
	}
	@Override
	public int compareTo(Photo o) {
		return o.getDateUploaded().compareTo(this.dateUploaded);
	}
	/**
	 * @return the airport
	 */
	public Airport getAirport() {
		return airport;
	}
	/**
	 * @param airport the airport to set
	 */
	public void setAirport(Airport airport) {
		this.airport = airport;
	}
	/**
	 * @return the storageId
	 */
	public String getStorageId() {
		return storageId;
	}
	/**
	 * @param storageId the storageId to set
	 */
	public void setStorageId(String storageId) {
		this.storageId = storageId;
	}

}
